Repository navigation
kad: Add global_addresses_only option - #668
Open
dmitry-markin wants to merge 4 commits into
Open
dmitry-markin wants to merge 4 commits into
dmitry-markin wants to merge 4 commits into
Conversation
2 tasks done
1 of 2 tasks
lexnv
reviewed
Oct 12, 2026
Comment on lines
+492
to
+496
| let mut message = KademliaMessage::from_bytes(message, self.replication_factor) | ||
| .ok_or(Error::InvalidData)?; | ||
| if self.remote_address_mode == RemoteAddressMode::GlobalOnly { | ||
| message.retain_global_addresses(); | ||
| } |
Collaborator
There was a problem hiding this comment.
nit: KademliaMessage::from_bytes keeps only the 20 (k replication factor) peers, then we filter out peers that don't have any global addresses. In the first run, we might truncate peers that contain valid global addresses that could contribute to the result after calling retain_global_addresses
Maybe we could pass RemoteAddressMode directly to KademliaMessage::from_bytes?
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add an option to filter-out non-global addresses received from DHT.
litep2p-side of a fix for paritytech/polkadot-sdk#8631.